﻿using System.Windows.Forms;
using ThirdLife.UI.WinForms.Modules;

namespace ThirdLife.UI.WinForms.Controls
{
  public partial class TLSimpleMetaverseConnection : Form, IWindowView
  {
    public TLSimpleMetaverseConnection()
    {
      InitializeComponent();
    }

    private ISimpleGridConnectionController controller;
    public ISimpleGridConnectionController Controller
    {
      get { return controller; }
      set { controller = value; }
    }

    #region IWindowView Members

    public void SetupView()
    {
      textBoxName.Text = Controller.GetDefaultName();
      textBoxPassword.Text = Controller.GetDefaultPassword();
      textBoxURL.Text = Controller.GetDefaultURL();
    }

    public void DestroyView()
    {
    }

    public void ShowWindow()
    {
      Show();
    }

    public void HideWindow()
    {
      Hide();
    }

    #endregion

    private void button1_Click(object sender, System.EventArgs e)
    {
      HideWindow();
      Controller.ConnectWithInfo(textBoxName.Text, textBoxPassword.Text, textBoxURL.Text);
    }
  }
}